<template>
	<view class="my-product-container">
		<view class="my-product-welcome">
			<view class="welcome">{{ info.tip }}</view>
		</view>
		<view class="my-product-main">
			<view class="my-product-tips" v-if="info.status == 0 || info.status == 30">*请填写下方资料，我们工作人员会在收到申请后联系您，请保持 电话畅通，谢谢。</view>
			<view class="my-product-tips" v-if="info.status == 10">*您的资料正在申请中。</view>
			<view class="my-product-tips" v-if="info.status == 20">*您的资料申请通过。</view>
			<view class="" v-if="info.status == 0 || info.status == 30">
				<view class="my-product-username">
					<uni-easyinput :disabled="info.status == 10 || info.status == 20" v-model="name" placeholder="请输入联系人姓名"></uni-easyinput>
				</view>
				<view class="my-product-mobile">
					<uni-easyinput :disabled="info.status == 10 || info.status == 20" v-model="phone" placeholder="请输入联系电话"></uni-easyinput>
				</view>
				<view class="my-product-apply"><button type="default" @click="submit">提交申请</button></view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			info: {},
			name: '',
			phone: ''
		};
	},
	onLoad() {
		this.init()
	},
	methods: {
		submit() {
			let data = {
				name: this.name,
				phone: this.phone
			};
			if(!data.name || !data.phone){
				uni.showToast({
					title: '请填写正确的信息',
					icon:'none'
				});
				return
			}
			this.$ajax('api/Member/SettledSubmit',data).then(()=>{
				uni.showToast({
					title: '申请成功'
				});
				this.init()
			})
		},
		init() {
			this.$ajax('api/Member/SettledInit').then(res => {
				this.info = res.Data;
				if (res.Data.status == 30) {
					uni.showModal({
						title: '您的申请被驳回',
						content: res.Data.remark,
						showCancel: false,
						cancelText: '取消',
						confirmText: '确定',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				}
			});
		}
	}
};
</script>

<style lang="scss">
.my-product-container {
	.my-product-welcome {
		width: 100%;
		height: 50rpx;
		background-color: #f3dcba;
		.welcome {
			font-size: 26rpx;
			color: #a77d40;
			margin-left: 30rpx;
			line-height: 50rpx;
		}
	}
	.my-product-main {
		padding-left: 33rpx;
		padding-right: 33rpx;
		margin-top: 33rpx;
		.my-product-tips {
			font-size: 24rpx;
			color: #999999;
		}
		.my-product-username {
			margin-top: 42rpx;
			box-sizing: border-box;
		}
		.my-product-mobile {
			margin-top: 32rpx;
		}
		.my-product-apply {
			margin-top: 76rpx;
			button {
				width: 691rpx;
				height: 81rpx;
				background: #202029;
				border: 1rpx solid #e6e6e6;
				border-radius: 8rpx;
				color: #ffffff;
				font-size: 30rpx;
			}
		}
	}
}
</style>
